package ed.hbut.supermarket1.service.impl;

import ed.hbut.supermarket1.entity.Supplier;
import ed.hbut.supermarket1.mapper.SupplierMapper;
import ed.hbut.supermarket1.service.SupplierService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    public SupplierMapper supplierMapper;

    @Override
    public List<Supplier> gerAllSupplier() {
        return supplierMapper.getAllSupplier();
    }

    @Override
    public void addSupplier(Supplier supplier) {
        supplierMapper.addSupplier(supplier);
    }

    @Override
    public Supplier getSupplierById(int id) {
        return supplierMapper.getSupplierById(id);
    }

    @Override
    public void updataSupplier(Supplier supplier) {
        log.info("业务逻辑中的supplier:{}", supplier);
        supplierMapper.updataSupplier(supplier);
    }

    @Override
    public void deleteSupplier(int id) {

        supplierMapper.deleteSupplier(id);
    }
}
